<?php
// +-------------------------------------------------------------------------------
// | DingZone [ A Rapid Development Framework For Dingtalk ]
// +-------------------------------------------------------------------------------
// | 钉钉markdown消息 v1.0
// |
// | Copyright (c) 2014-2018 http://www.heimalanshi.com All rights reserved.
// | Author : Jie
// | Date : 2018-08-09
// +-------------------------------------------------------------------------------

namespace ding\msg\chat;

/**
 * Markdown会话消息
 *
 * @package ding\msg\chat
 */
class MarkdownChatMsg extends ChatMsg {
    protected $title;
    protected $markdownText;

    /**
     * markdown消息构造函数
     *
     * @param $title
     * @param $markdownText
     */
    public function __construct($title, $markdownText) {
        parent::__construct("markdown");
        $this->title = $title;
        $this->markdownText = $markdownText;
    }

    /**
     * 获取消息体
     * {
     *           "title":"杭州天气",
     *           "text": "#### 杭州天气 @156xxxx8827\n" +
     *                   "> 9度，西北风1级，空气良89，相对温度73%\n\n" +
     *                   "> ![screenshot](http://image.jpg)\n"  +
     *                   "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n"
     * }
     * @return array
     */
    public function getMsgContent() {
        return [
            'title' => $this->title,
            'text' => $this->markdownText
        ];
    }

}
